package br.edu.delta.model;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 * <p>
 * <b>Title:</b> Usuario
 * </p>
 * 
 * <p>
 * <b>Description:</b> Usuario
 * </p>
 * 
 * <p>
 * <b>Company: </b>
 * </p>
 * 
 * @author Denis
 * 
 * @version 1.0.0
 */
@Entity
@Table(name = "tbl_usuarios")
@SequenceGenerator(name = EntidadeImpl.SEQUENCE_GENERATOR, sequenceName = "seq_tbl_usuario", allocationSize = 1, initialValue = 1)
public class Usuario extends Pessoa {

	/** Atributo serialVersionUID. */
	private static final long serialVersionUID = 5886040720398125676L;

	/** Atributo acesso. */
	@OneToOne(fetch = FetchType.EAGER, cascade = { CascadeType.ALL }, optional = false, targetEntity = AcessoUsuario.class)
	@JoinColumn(insertable = true, unique = false, name = "id_acesso_usuario", updatable = true, nullable = false)
	private AcessoUsuario acesso;

	/** Atributo userAdmin. */
	@Column(nullable = true, name = "USER_ADMIN")
	private boolean userAdmin;

	/**
	 * Retorna o valor do atributo <code>userAdmin</code>
	 * 
	 * @return <code>boolean</code>
	 */
	public boolean isUserAdmin() {

		return this.userAdmin;
	}

	/**
	 * Define o valor do atributo <code>userAdmin</code>.
	 * 
	 * @param userAdmin
	 */
	public void setUserAdmin(final boolean userAdmin) {

		this.userAdmin = userAdmin;
	}

	/**
	 * Retorna o valor do atributo <code>acesso</code>
	 * 
	 * @return <code>AcessoUsuario</code>
	 */
	public AcessoUsuario getAcesso() {

		return acesso;
	}

	/**
	 * Define o valor do atributo <code>acesso</code>.
	 * 
	 * @param acesso
	 */
	public void setAcesso(AcessoUsuario acesso) {

		this.acesso = acesso;
	}

}
